@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">交易哈希: {{ $transaction->hash }}</div>

                <div class="card-body">

                    <p>
                        交易状态: 
                        <span class="text-{{ $transaction->isError ? 'danger' : 'success' }}">
                        {{ $transaction->isError ? '失败' : '成功' }}
                        </span>
                    </p>
                    <p>
                        区块: 
                        {{ $transaction->blockNumber }}
                    </p>
                    <p>
                        交易时间: 
                        {{ date('Y-m-d H:i:s', $transaction->timeStamp) }}
                    </p>
                    <p>
                        转发者: 
                        {{ $transaction->from }}
                    </p>
                    <p>
                        接收者: 
                        {{ $transaction->to }}
                    </p>
                    <p>
                        合约地址:
                        {{ $transaction->contractAddress }}
                    </p>

                    @if ($transaction->input != '0x')
                    <p>
                        Token交易:
                        {{ substr($transaction->from, 0, 12) . '...' }}
                        转发了
                        {{ transferInputToValue($transaction->input) }} 
                        个Token到
                        {{ substr($transaction->to, 0, 12) . '...' }}
                    </p>
                    @endif
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
